package com.wimcorp.magic.behaviour.attack;

import javax.persistence.Entity;

import com.wimcorp.magic.behaviour.attack.AttackBehaviour.AttackType;
import com.wimcorp.magic.cards.Creature;
import com.wimcorp.magic.players.Player;


@Entity
public class Trample extends AttackBehaviour {

	private static Trample instance = new Trample();

	protected Trample() {
		
	}
	
	public Trample(Creature creature,AttackBehaviour attackBehaviour) {
		super(creature,attackBehaviour);
	}
	
	public static Trample instance() {
		return instance;
	}
	
	protected void attack(Creature defender) {
		getAttackBehaviour().attack(defender);
		defender.getPlayer().subtractLife(getCreature().getActualPower());
	}
	
	@Override
	public void counter(Creature attacker) {
		getAttackBehaviour().counter(attacker);
	}

	
	protected void attack(Player defender) {
		getAttackBehaviour().attack(defender);
	}
	
	public int priority() {
		return AttackType.TRAMPLE.ordinal();
	}
	
	public boolean equals(Object o){
		return o instanceof Trample;
	}


}
